﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="media.aspx.cs" Inherits="Wedn.Web.UI.Admin.Include.Media" %>

<link href="resource/css/media.css" rel="stylesheet" />
<script type="text/javascript">
    $(function () {
        var $_currentATag;
        $('.delete-file').click(function () {
            if (confirm('确定删除?')) {
                $_currentATag = $(this);
                var paths = $(this).prev('a').attr('href').split('=');
                var path = paths[0];
                if (paths.length > 1) {
                    path = paths[1];
                }
                //异步删除
                $.get('handler/file-delete.ashx', { path: path }, function (data) {
                    $_currentATag.parent().remove();
                });
            }
        });
        $('.dir').click(function () {
            loadIframe('media' + $(this).attr('href'));
            //$('#iframe').load();
            return false;
        });
    });
</script>
<div id="screen-meta">
    <div id="screen-meta-option"></div>
    <div id="screen-meta-link">
        <div id="contextual-help-link-wrap">
            <a id="contextual-help-link" class="show-settings">帮助</a>
        </div>
        <div id="screen-options-link-wrap">
            <a id="show-settings-link" class="show-settings">显示选项</a>
        </div>
    </div>
</div>
<div class="hd-title">
    <h1 class="media">媒体库</h1>
    <a href="upload.aspx" class="add-new">添加</a>
</div>
<div class="explorer">
    <p class="map">当前位置：<%=currentPath %></p>
    <ul id="file-list">
        <%foreach (var item in currentDir.GetFileSystemInfos())
          {%>
        <li>
            <%if (item is System.IO.DirectoryInfo)
              {%>
            <a class="dir" href="?path=<%=path+item.Name %>/" title="点击打开此文件夹">
                <img src="resource/images/file/folder.png" alt="点击打开此文件夹" />
            </a>
            <a class="delete-file" title="删除">x</a>
            <p class="info">
                <span title="文件夹:<%=item.Name %>"><%=item.Name %></span>
                <br />
                <span class="gray"><%=((System.IO.DirectoryInfo)item).GetFileSystemInfos().Length %>个对象</span>
            </p>
            <%}
              else
              {%>
            <a class="file" href="<%=path+item.Name %>" title="文件:<%=item.Name %>" target="_blank">
                <img src="resource/images/file/<%=GetFileImage(item.Extension) %>" />
            </a>
            <a class="delete-file">x</a>
            <p class="info">
                <span title="<%=item.Name %>"><%=item.Name %></span>
            </p>
            <% } %>
        </li>
        <% } %>
    </ul>
</div>
